<script>
	// 腾讯chart
	// 参考:https://cloud.tencent.com/document/product/269/64507
	// 腾讯chart
	import {
		useStore
	} from 'vuex'
	import storage from '@/utils/storage'
	export default {
		onLaunch: function(options) {
			//腾讯chart

			//腾讯chart
			this.getParmas(options)
			// #ifdef MP
			this.updateManager()
			// #endif
		},
		onShow: function(options) {
			this.getParmas(options)
			console.log('App Show')
		},
		onLoad() {
			console.log('App Load');
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			// 获取启动参数
			getParmas(options, key = 'parent_id') {
				// 该没有分销
				return
				// 分销
				const store = useStore()
				let parent_id
				if (options.query && options.query.scene) {
					parent_id = decodeURIComponent(options.query.scene).split('&')[0].split('=')[1]
				} else if (options.query && options.query[key]) {
					parent_id = options.query[key]
				}
				if (parent_id) {
					storage.set('PARENT_ID', parent_id, 30 * 86400 * 3)
					store.commit('M_PARENT_ID', parent_id)
				}
			},
			/**
			 * 小程序主动更新
			 */
			updateManager() {
				const updateManager = uni.getUpdateManager();
				updateManager.onCheckForUpdate(res => {
					// 请求完新版本信息的回调
					// console.log(res.hasUpdate)
				})
				updateManager.onUpdateReady(() => {
					uni.showModal({
						title: '更新提示',
						content: '新版本已经准备好，即将重启应用',
						showCancel: false,
						success(res) {
							if (res.confirm) {
								// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
								updateManager.applyUpdate()
							}
						}
					})
				})
				updateManager.onUpdateFailed(() => {
					// 新的版本下载失败
					uni.showModal({
						title: '更新提示',
						content: '新版本下载失败',
						showCancel: false
					})
				})
			},
		}
	}
</script>

<style lang="scss">
	/*uview-plus */
	@import "@/uni_modules/uview-plus/index.scss";
	/* 自定义样式 */
	@import "@/common/scss/common.scss";
	@import "@/common/scss/animation.scss";
	@import "@/common/scss/theme.scss";

	//腾讯chart 
	uni-page-body,
	html,
	body,
	page {
		width: 100% !important;
		height: 100% !important;
		// overflow: hidden;
	}

	// 腾讯chart 
	page {
		background-color: $--base-cont-bg;
		font-family: PingFang SC-Bold, PingFang SC;
		/* #ifndef MP-ALIPAY */
		height: 100%;
		/* #endif */
		/* #ifdef MP-ALIPAY */
		height: 100vh;
		/* #endif */
		font-size: 28rpx;
		word-break: break-all;
	}

	.base-cont-bg {
		background: $--base-cont-bg;
	}

	.w-calc-30 {
		padding: 0 30rpx;
		width: calc(100% - 60rpx);
	}

	.hb {
		height: 100%;
		box-sizing: border-box;
	}

	.hidden {
		overflow: hidden;
	}

	.base-color {
		color: $--base-color;
	}

	.base-color-2 {
		color: $--base-color2;
	}

	.base-color-3 {
		color: $--base-color3;
	}

	.base-color-gray {
		color: $--base-color-gray;
	}

	.base-color-gray2 {
		color: $--base-color-gray2;
	}

	.base-color-dark {
		color: $--base-color-dark;
	}

	.base-color-dark2 {
		color: $--base-color-dark2;
	}

	.base-price {
		color: $--base-color-price;
	}

	.base-success {
		color: $--base-color-success;
	}

	.base-bg {
		background: $--base-bg;
	}

	.base-bg-2 {
		background: $--base-bg2;
	}

	.colorf {
		color: #fff;
	}

	.bgf {
		background: #fff;
	}

	.fixed {
		position: fixed;
	}

	.absolute {
		position: absolute;
	}

	.relative {
		position: relative;
	}

	.w100 {
		width: 100%;
	}

	.h100 {
		height: 100%;
	}

	.card {
		background: #fff;
		border-radius: 15rpx;
	}

	.cover-height {
		height: 100%;
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
	}

	.row {
		display: flex;
		flex-direction: row;
	}

	.column {
		display: flex;
		flex-direction: column;
	}

	.justify-start {
		display: flex;
		justify-content: flex-start;
	}

	.justify-center {
		display: flex;
		justify-content: center;
	}

	.justify-end {
		display: flex;
		justify-content: flex-end;
	}

	.justify-around {
		display: flex;
		justify-content: space-around;
	}

	.justify-evenly {
		display: flex;
		justify-content: space-evenly;
	}

	.justify-between {
		display: flex;
		justify-content: space-between;
	}

	.align-start {
		display: flex;
		align-items: flex-start;
	}

	.align-center {
		display: flex;
		align-items: center;
	}

	.align-end {
		display: flex;
		align-items: flex-end;
	}

	.center {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.centerV {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
	}

	.wrap {
		flex-wrap: wrap;
	}

	.flex-1 {
		flex: 1;
	}

	.ellipsis {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		box-sizing: border-box;
		width: 100%;
		-webkit-line-clamp: 1;
	}

	.lines-2 {
		-webkit-line-clamp: 2 !important;
	}

	.lines-3 {
		-webkit-line-clamp: 3 !important;
	}

	.bold {
		font-weight: bold;
	}

	.line-through {
		text-decoration: line-through;
	}

	.nowrap {
		white-space: nowrap;
	}

	.scrollx {
		overflow-x: scroll;
	}

	.scrolly {
		overflow-y: scroll;
	}

	.cvauto {
		content-visibility: auto;
	}

	.active_bg {
		&:active {
			background: rgba(0, 0, 0, .1) !important;
		}
	}

	.text-center {
		text-align: center;
	}

	.text-right {
		text-align: right;
	}

	.text-left {
		text-align: left;
	}

	.border-box {
		box-sizing: border-box;
	}

	.shrink0 {
		flex-shrink: 0;
	}
</style>